package tr.gov.tubitak.bilgem.esya.certselector;

import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;

/**
 * Created by IntelliJ IDEA.
 * User: ramazan.girgin
 * Date: 3/21/12
 * Time: 1:17 PM
 * To change this template use File | Settings | File Templates.
 */
public class EReaderCertTreeManager {
    ReaderCertListTree readerCertListTree;

    public void setShowOnlyQualifiedCerts(boolean showOnlyQualifiedCerts) {
        this.showOnlyQualifiedCerts = showOnlyQualifiedCerts;
    }

    boolean showOnlyQualifiedCerts;

    public EReaderCertTreeManager(ReaderCertListTree readerCertListTree,boolean showOnlyQualifiedCerts){
        this.readerCertListTree = readerCertListTree;
        this.showOnlyQualifiedCerts = showOnlyQualifiedCerts;
    }

    public void loadTree(){
        EReaderListNode eReaderListNode = new EReaderListNode();
        readerCertListTree.setModel(new DefaultTreeModel(eReaderListNode));
        readerCertListTree.setRootVisible(true);
        ReaderListWorker populator = new ReaderListWorker(readerCertListTree,eReaderListNode);
        populator.setmShowOnlyQualified(this.showOnlyQualifiedCerts);
        populator.setmShowOnlyQualified(showOnlyQualifiedCerts);
        populator.execute();
    }
}
